; Music of Max Headroom (1986) (Quicksilva)
; Ripped by Megachur the 01/03/2007

	write "MAXHEADR.BIN"

music_date_rip	equ &0137
music_adr	equ &35c0
first_theme	equ 1
last_theme	equ 6	; 1 -> 6

	read "music_header_v1_0.asm"

	jp l38c7	; play
	jp l37fd	; init
	jp l35d3	; sound fx ?
	xor a
	ld (l3bc5),a
	ld (l37e7),a
	jp l38b0
.l35d3
	push af
	xor a
	ld (l37e7),a
	ld (l3bc6),a
	ld (l3bc8),a
	pop af
	sla a
	ld d,#00
	ld e,a
	ld hl,l371b
	add hl,de
	ld a,(hl)
	inc hl
	ld h,(hl)
	ld l,a
	ld b,#0f
	ld de,l37e8
.l35f1
	ld a,(hl)
	ld (de),a
	inc hl
	inc de
	djnz l35f1
	ld a,(l37e9)
	ld (l37f7),a
	ld a,(l3bbd)
	or #2d
	ld hl,l37ef
	and (hl)
	ld (l3bbd),a
	ld b,a
	ld c,#07
	call l3889
	ld hl,(l37ea)
	ld (l37f9),hl
	ld de,(l37ec)
	ld (l37fb),de
	ld b,l
	ld c,#06
	call l3889
	ld c,#00
	call l3889
	ld b,h
	inc c
	call l3889
	ld b,e
	inc c
	inc c
	inc c
	call l3889
	ld b,d
	inc c
	call l3889
	ld bc,#000b
	call l3889
	ld a,(l37ee)
	ld b,a
	inc c
	call l3889
	ld b,#10
	ld c,#08
	call l3889
	inc c
	inc c
	call l3889
	ld b,#00
	ld c,#0d
	call l3889
	ld hl,l37e7
	inc (hl)
	ret
.l365f
	ld a,(l37e8)
	and a
	jp z,l36f7
	dec a
	ld (l37e8),a
	ld a,(l37f7)
	and a
	jr nz,l368b
	ld a,(l37f6)
	and a
	ret z
	dec a
	ld (l37f6),a
	ld a,(l37e9)
	ld (l37f7),a
	ld hl,(l37ea)
	ld (l37f9),hl
	ld hl,(l37ec)
	ld (l37fb),hl
.l368b
	ld hl,l37f7
	dec (hl)
	ld a,(l37f4)
	and a
	jr z,l36b2
	jp p,l36a5
	ld hl,(l37f9)
	ld de,(l37f0)
	add hl,de
	ld (l37f9),hl
	jr l36b2
.l36a5
	ld hl,(l37f9)
	ld de,(l37f0)
	and a
	sbc hl,de
	ld (l37f9),hl
.l36b2
	ld a,(l37f5)
	and a
	jr z,l36d5
	jp p,l36c8
	ld hl,(l37fb)
	ld de,(l37f2)
	add hl,de
	ld (l37fb),hl
	jr l36d5
.l36c8
	ld hl,(l37fb)
	ld de,(l37f2)
	and a
	sbc hl,de
	ld (l37fb),hl
.l36d5
	ld hl,(l37f9)
	ld b,l
	ld c,#06
	call l3889
	ld c,#00
	call l3889
	ld b,h
	inc c
	call l3889
	ld hl,(l37fb)
	ld b,l
	inc c
	inc c
	inc c
	call l3889
	ld b,h
	inc c
	jp l3889
.l36f7
	ld (l37e7),a
	inc a
	ld (l3bc6),a
	ld (l3bc8),a
	ld a,(l3bbd)
	or #2d
	ld (l3bbd),a
	ld b,a
	ld c,#07
	call l3889
	ld b,#00
	inc c
	call l3889
	inc c
	inc c
	call l3889
	ret
.l371b
	dw l3733,l3742,l3751,l3760
	dw l376f,l377e,l378d,l379c
	dw l37ab,l37ba,l37c9,l37d8
.l3733
	db #14,#15,#80,#00,#d0,#00,#0f,#f2
.l3742 equ $ + 7
	db #19,#00,#1b,#00,#ff,#ff,#00,#14
	db #05,#80,#01,#c0,#01,#0f,#fa,#23
.l3751 equ $ + 6
	db #00,#28,#00,#01,#01,#05,#14,#05
	db #80,#00,#40,#00,#0a,#fa,#05,#00
.l3760 equ $ + 5
	db #05,#00,#ff,#01,#05,#28,#08,#80
	db #00,#87,#00,#14,#d2,#23,#00,#28
.l376f equ $ + 4
	db #00,#ff,#ff,#06,#32,#06,#0a,#00
	db #0f,#00,#14,#d2,#03,#00,#04,#00
.l377e equ $ + 3
	db #ff,#01,#0a,#14,#06,#28,#00,#2b
	db #00,#0f,#fa,#20,#20,#20,#20,#ff
.l378d equ $ + 2
	db #ff,#06,#32,#1e,#00,#00,#01,#00
	db #19,#d2,#01,#40,#01,#40,#ff,#ff
.l379c equ $ + 1
	db #00,#28,#28,#00,#00,#01,#00,#14
	db #d2,#01,#40,#01,#40,#01,#01,#00
.l37ab
	db #1e,#1f,#df,#01,#de,#01,#1e,#fa
.l37ba equ $ + 7
	db #00,#00,#00,#00,#00,#00,#00,#1e
	db #1f,#7b,#01,#7c,#01,#1e,#fa,#00
.l37c9 equ $ + 6
	db #00,#00,#00,#00,#00,#00,#1e,#1f
	db #3e,#01,#3d,#01,#1e,#fa,#00,#00
.l37d8 equ $ + 5
	db #00,#00,#00,#00,#00,#1e,#1f,#ef
	db #00,#ee,#00,#1e,#fa,#00,#00,#00
	db #00,#00,#00,#00
.l37ee equ $ + 7
.l37ec equ $ + 5
.l37ea equ $ + 3
.l37e9 equ $ + 2
.l37e8 equ $ + 1
.l37e7
	db #00,#00,#00,#00,#00,#00,#00,#00
.l37f6 equ $ + 7
.l37f5 equ $ + 6
.l37f4 equ $ + 5
.l37f2 equ $ + 3
.l37f0 equ $ + 1
.l37ef
	db #00,#00,#00,#00,#00,#00,#00,#00
.l37fb equ $ + 4
.l37f9 equ $ + 2
.l37f7
	db #00,#00,#00,#00,#00,#00
	;
.init_music
.l37fd
	;
	ld (l3bc4),a
	xor a
	ld (l3bc5),a
	ld (l37e7),a
	ld (l3c02),a
	inc a
	ld (l3c05),a
	ld (l3c04),a
	ld (l3c06),a
	ld (l3c07),a
	ld a,(l3bc4)
	ld b,a
	ld a,#fa
.l381d
	add #06
	djnz l381d
	ld d,#00
	ld e,a
	ld hl,l3c32
	add hl,de
	ld a,(hl)
	ld (l3c56),a
	ld (l3c5c),a
	inc hl
	ld a,(hl)
	ld (l3c57),a
	ld (l3c5d),a
	inc hl
	ld a,(hl)
	ld (l3c58),a
	ld (l3c5e),a
	inc hl
	ld a,(hl)
	ld (l3c59),a
	ld (l3c5f),a
	inc hl
	ld a,(hl)
	ld (l3c5a),a
	ld (l3c60),a
	inc hl
	ld a,(hl)
	ld (l3c5b),a
	ld (l3c61),a
	call l3c62
	call l3c6f
	call l3c7c
	ld hl,(l3be7)
	inc hl
	ld a,(hl)
	ld (l3bd0),a
	ld (l3bd1),a
	call l38b0
	xor a
	ld hl,l3bd2
	ld (hl),a
	ld de,l3bd3
	ld bc,#0008
	ldir
	inc a
	ld (l3bc6),a
	ld (l3bc7),a
	ld (l3bc8),a
	ld (l3bc5),a
	ret
.l3889
	push bc
	push de
	ld e,b
	ld b,#f4
	out (c),c
	push bc
	ld bc,#f600
	out (c),c
	ld a,#c0
	out (c),a
	nop
	nop
	out (c),c
	pop bc
	out (c),e
	push bc
	ld bc,#f600
	add a
	out (c),a
	nop
	nop
	out (c),c
	pop bc
	pop de
	pop bc
	ret
.l38b0
	ld b,#00
	ld c,#0d
.l38b4
	call l3889
	dec c
	jp p,l38b4
	ld b,#3f
	ld a,b
	ld (l3bbd),a
	ld c,#07
	call l3889
	ret
	;
.play_music
.l38c7
	;
	ld a,(l37e7)
	and a
	call nz,l365f
	ld a,(l3bc5)
	and a
	ret z
	call l3c8a
	call l3d9d
	call l3e55
	ld hl,l3bd1
	dec (hl)
	ret nz
	ld a,(l3bd0)
	ld (hl),a
	ld a,(l3bd2)
	and a
	jp nz,l39cc
	ld (l3c10),a
	ld (l3bd8),a
	ld (l3bfc),a
	ld a,(l3bdb)
	and #f0
	ld (l3bf3),a
	ld a,(l3bde)
	and #f0
	ld (bc),a
	add hl,sp
	ld bc,#0021
	nop
	ld (l3bc9),hl
	ld hl,#0000
	ld (l3bcb),hl
	ld a,#01
	ld (l3bff),a
.l3916
	ld hl,#0000
	ld (l3bbe),hl
.l391c
	ld hl,(l3be7)
	ld (l3bc0),hl
	ld de,(l3bbe)
	add hl,de
	ld a,(hl)
	cp #7f
	jr nz,l3946
	ld hl,(l3c56)
	inc hl
	inc hl
	ld (l3c56),hl
.l3934
	call l3c62
	ld hl,(l3be7)
	ld a,h
	or l
	jr nz,l3916
	ld hl,(l3c5c)
	ld (l3c56),hl
	jr l3934
.l3946
	cp #80
	jr c,l396f
	ld hl,l3bbe
	inc (hl)
	and #7f
	cp #20
	jr c,l3959
	call l3df9
	jr l391c
.l3959
	add a
	ld e,a
	ld d,#00
	ld hl,l3db5
	add hl,de
	ld a,(hl)
	ld (l396b),a
	inc hl
	ld a,(hl)
	ld (l396c),a
.l396c equ $ + 2
.l396b equ $ + 1
	call l35d3
	jr l391c
.l396f
	push af
	ld a,(l3be4)
	ld (l3bd2),a
	pop af
	ld (l3c0d),a
	call l3b8f
	ld a,(l3bc6)
	and a
	jr z,l39bd
	ld b,#00
	ld c,#08
	call l3889
	ld a,(l3c11)
	ld b,a
	ld c,#06
	call l3889
	ld hl,l3c08
	ld b,(hl)
	ld a,b
	ld (l3bed),a
	ld c,#00
	call l3889
	inc hl
	ld b,(hl)
	ld a,b
	ld (l3bf0),a
	ld c,#01
	call l3889
	ld a,(l3bbd)
	or #09
	ld hl,l3bcd
	and (hl)
	ld (l3bbd),a
	ld b,a
	ld c,#07
	call l3889
.l39bd
	ld hl,l3bbe
	inc (hl)
	ld hl,(l3be7)
	ld de,(l3bbe)
	add hl,de
	ld (l3be7),hl
.l39cc
	ld hl,l3bd2
	dec (hl)
	ld a,(l3bd3)
	and a
	jp nz,l3aab
	ld (l3bd9),a
	ld (l3bfd),a
	ld a,(l3bdc)
	and #f0
	ld (l3bf4),a
	ld a,(l3bdf)
	and #f0
	ld (l3bf7),a
	ld hl,#0001
	ld (l3bc9),hl
	ld hl,#0002
	ld (l3bcb),hl
	ld a,#01
	ld (l3c00),a
.l39fe
	ld hl,#0000
	ld (l3bbe),hl
.l3a04
	ld hl,(l3be9)
	ld (l3bc0),hl
	ld de,(l3bbe)
	add hl,de
	ld a,(hl)
	cp #7f
	jr nz,l3a2e
	ld hl,(l3c58)
	inc hl
	inc hl
	ld (l3c58),hl
.l3a1c
	call l3c6f
	ld hl,(l3be9)
	ld a,h
	or l
	jr nz,l39fe
	ld hl,(l3c5e)
	ld (l3c58),hl
	jr l3a1c
.l3a2e
	cp #80
	jr c,l3a57
	ld hl,l3bbe
	inc (hl)
	and #7f
	cp #20
	jr c,l3a41
	call l3df9
	jr l3a04
.l3a41
	add a
	ld e,a
	ld d,#00
	ld hl,l3db5
	add hl,de
	ld a,(hl)
	ld (l3a53),a
	inc hl
	ld a,(hl)
	ld (l3a54),a
.l3a54 equ $ + 2
.l3a53 equ $ + 1
	call l35d3
	jr l3a04
.l3a57
	push af
	ld a,(l3be5)
	ld (l3bd3),a
	pop af
	ld (l3c0e),a
	call l3b8f
	ld a,(l3bc7)
	and a
	jr z,l3a9c
	ld b,#00
	ld c,#09
	call l3889
	ld hl,l3c08
	ld b,(hl)
	ld a,b
	ld (l3bee),a
	ld c,#02
	call l3889
	inc hl
	ld b,(hl)
	ld a,b
	ld (l3bf1),a
	ld c,#03
	call l3889
	ld a,(l3bbd)
	or #12
	ld hl,l3bce
	and (hl)
	ld (l3bbd),a
	ld b,a
	ld c,#07
	call l3889
.l3a9c
	ld hl,l3bbe
	inc (hl)
	ld hl,(l3be9)
	ld de,(l3bbe)
	add hl,de
	ld (l3be9),hl
.l3aab
	ld hl,l3bd3
	dec (hl)
	ld a,(l3bd4)
	and a
	jp nz,l3b8a
	ld (l3bda),a
	ld (l3bfe),a
	ld a,(l3bdd)
	and #f0
	ld (l3bf5),a
	ld a,(l3be0)
	and #f0
	ld (l3bf8),a
	ld hl,#0002
	ld (l3bc9),hl
	ld hl,#0004
	ld (l3bcb),hl
	ld a,#01
	ld (l3c01),a
.l3add
	ld hl,#0000
	ld (l3bbe),hl
.l3ae3
	ld hl,(l3beb)
	ld (l3bc0),hl
	ld de,(l3bbe)
	add hl,de
	ld a,(hl)
	cp #7f
	jr nz,l3b0d
	ld hl,(l3c5a)
	inc hl
	inc hl
	ld (l3c5a),hl
.l3afb
	call l3c7c
	ld hl,(l3beb)
	ld a,h
	or l
	jr nz,l3add
	ld hl,(l3c60)
	ld (l3c5a),hl
	jr l3afb
.l3b0d
	cp #80
	jr c,l3b36
	ld hl,l3bbe
	inc (hl)
	and #7f
	cp #20
	jr c,l3b20
	call l3df9
	jr l3ae3
.l3b20
	add a
	ld e,a
	ld d,#00
	ld hl,l3db5
	add hl,de
	ld a,(hl)
	ld (l3b32),a
	inc hl
	ld a,(hl)
	ld (l3b33),a
.l3b33 equ $ + 2
.l3b32 equ $ + 1
	call l35d3
	jr l3ae3
.l3b36
	push af
	ld a,(l3be6)
	ld (l3bd4),a
	pop af
	ld (l3c0f),a
	call l3b8f
	ld a,(l3bc8)
	and a
	jr z,l3b7b
	ld b,#00
	ld c,#0a
	call l3889
	ld hl,l3c08
	ld b,(hl)
	ld a,b
	ld (l3bef),a
	ld c,#04
	call l3889
	inc hl
	ld b,(hl)
	ld a,b
	ld (l3bf2),a
	ld c,#05
	call l3889
	ld a,(l3bbd)
	or #24
	ld hl,l3bcf
	and (hl)
	ld (l3bbd),a
	ld b,a
	ld c,#07
	call l3889
.l3b7b
	ld hl,l3bbe
	inc (hl)
	ld hl,(l3beb)
	ld de,(l3bbe)
	add hl,de
	ld (l3beb),hl
.l3b8a
	ld hl,l3bd4
	dec (hl)
	ret
.l3b8f
	cp #7e
	jp z,l3e05
	ld b,a
	and #0f
	add a
	ld d,#00
	ld e,a
	ld hl,l3c1a
	add hl,de
	ld de,l3c08
	ld c,#ff
	ldi
	ldi
	ld a,b
	ld hl,l3c08
	ld e,(hl)
	inc hl
	ld d,(hl)
.l3baf
	sub #10
	jr c,l3bb9
	srl d
	rr e
	jr l3baf
.l3bb9
	ld (hl),d
	dec hl
	ld (hl),e
	ret
.l3bc4 equ $ + 7
.l3bc0 equ $ + 3
.l3bbe equ $ + 1
.l3bbd
	db #3f,#00,#00,#00,#00,#00,#00,#01
.l3bcb equ $ + 6
.l3bc9 equ $ + 4
.l3bc8 equ $ + 3
.l3bc7 equ $ + 2
.l3bc6 equ $ + 1
.l3bc5
	db #00,#00,#00,#00,#00,#00,#00,#00
.l3bd0 equ $ + 3
.l3bcf equ $ + 2
.l3bce equ $ + 1
.l3bcd
	db #00,#00,#00,#00
.l3bd8 equ $ + 7
.l3bd4 equ $ + 3
.l3bd3 equ $ + 2
.l3bd2 equ $ + 1
.l3bd1
	db #00,#00,#00,#00,#00,#00,#00,#00
.l3be0 equ $ + 7
.l3bdf equ $ + 6
.l3bde equ $ + 5
.l3bdd equ $ + 4
.l3bdc equ $ + 3
.l3bdb equ $ + 2
.l3bda equ $ + 1
.l3bd9
	db #00,#00,#00,#00,#00,#00,#00,#00
.l3be8 equ $ + 7
.l3be7 equ $ + 6
.l3be6 equ $ + 5
.l3be5 equ $ + 4
.l3be4 equ $ + 3
.l3be3 equ $ + 2
.l3be2 equ $ + 1
.l3be1
	db #00,#00,#00,#00,#00,#00,#00,#00
.l3bf0 equ $ + 7
.l3bef equ $ + 6
.l3bee equ $ + 5
.l3bed equ $ + 4
.l3bec equ $ + 3
.l3beb equ $ + 2
.l3bea equ $ + 1
.l3be9
	db #00,#00,#00,#00,#00,#00,#00,#00
.l3bf8 equ $ + 7
.l3bf7 equ $ + 6
.l3bf6 equ $ + 5
.l3bf5 equ $ + 4
.l3bf4 equ $ + 3
.l3bf3 equ $ + 2
.l3bf2 equ $ + 1
.l3bf1
	db #00,#00,#00,#00,#00,#00,#00,#00
.l3c00 equ $ + 7
.l3bff equ $ + 6
.l3bfe equ $ + 5
.l3bfd equ $ + 4
.l3bfc equ $ + 3
.l3bfb equ $ + 2
.l3bfa equ $ + 1
.l3bf9
	db #00,#00,#00,#00,#00,#00,#00,#00
.l3c08 equ $ + 7
.l3c07 equ $ + 6
.l3c06 equ $ + 5
.l3c05 equ $ + 4
.l3c04 equ $ + 3
.l3c03 equ $ + 2
.l3c02 equ $ + 1
.l3c01
	db #00,#00,#00,#00,#00,#00,#00,#00
.l3c10 equ $ + 7
.l3c0f equ $ + 6
.l3c0e equ $ + 5
.l3c0d equ $ + 4
.l3c09
	db #00,#00,#00,#00,#00,#00,#00,#00
.l3c11
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00
.l3c1a
	dw #077c,#0708,#06b0,#0640
	dw #05ec,#0594,#0544,#04f8
	dw #04b0,#0470,#042c,#03f0
.l3c32
	dw #414a,#419c,#41c0,#4337
	dw #433b,#438d,#44d4,#44fe
	dw #4520,#3ff3,#4055,#40a1
	dw #46c7,#46cb,#46cf,#4705
.l3c59 equ $ + 7
.l3c58 equ $ + 6
.l3c57 equ $ + 5
.l3c56 equ $ + 4
	dw #4709,#470d,#0000,#0000
.l3c61 equ $ + 7
.l3c60 equ $ + 6
.l3c5f equ $ + 5
.l3c5e equ $ + 4
.l3c5d equ $ + 3
.l3c5c equ $ + 2
.l3c5b equ $ + 1
.l3c5a
	dw #0000,#0000,#0000,#0000
.l3c62
	ld hl,(l3c56)
	ld a,(hl)
	ld (l3be7),a
	inc hl
	ld a,(hl)
	ld (l3be8),a
	ret
.l3c6f
	ld hl,(l3c58)
	ld a,(hl)
	ld (l3be9),a
	inc hl
	ld a,(hl)
	ld (l3bea),a
	ret
.l3c7c
	ld hl,(l3c5a)
	ld a,(hl)
	ld (l3beb),a
	inc hl
	ld a,(hl)
	ld (l3bec),a
	ret
.l3c89
	nop
.l3c8a
	ld a,(l3c89)
	xor #01
	ld (l3c89),a
	ret z
	ld a,(l3bc6)
	and a
	jr z,l3cae
	ld a,(l3be1)
	and a
	jr z,l3cae
	ld hl,#0000
	ld (l3bc9),hl
	ld hl,#0001
	ld (l3bcb),hl
	call l3ce7
.l3cae
	ld a,(l3bc7)
	and a
	jr z,l3cc9
	ld a,(l3be2)
	and a
	jr z,l3cc9
	ld hl,#0001
	ld (l3bc9),hl
	ld hl,#0003
	ld (l3bcb),hl
	call l3ce7
.l3cc9
	ld a,(l3bc8)
	and a
	jr z,l3ce4
	ld a,(l3be3)
	and a
	jr z,l3ce4
	ld hl,#0002
	ld (l3bc9),hl
	ld hl,#0005
	ld (l3bcb),hl
	call l3ce7
.l3ce4
	jp l3d6a
.l3ce7
	ld a,(l3c02)
	ld (l3c03),a
	ld de,(l3bc9)
	ld hl,l3c0d
	add hl,de
	ld a,(hl)
	ld hl,l3c03
	cp #40
	jr nc,l3d11
	sla (hl)
	cp #30
	jr nc,l3d11
	sla (hl)
	cp #20
	jr nc,l3d11
	sla (hl)
	cp #10
	jr nc,l3d11
	sla (hl)
.l3d11
	ld a,(l3c04)
	and a
	jp m,l3d41
	ld hl,l3bed
	ld de,(l3bc9)
	add hl,de
	ld (l3bc9),hl
	ld a,(hl)
	ld hl,l3c03
	add (hl)
	push af
	ld hl,(l3bc9)
	inc hl
	inc hl
	inc hl
	ld a,(hl)
	adc #00
	ld bc,(l3bcb)
	ld b,a
	call l3889
	dec c
	pop af
	ld b,a
	call l3889
	ret
.l3d41
	ld hl,l3bed
	ld de,(l3bc9)
	add hl,de
	ld (l3bc9),hl
	ld a,(hl)
	ld hl,l3c03
	sub (hl)
	push af
	ld hl,(l3bc9)
	inc hl
	inc hl
	inc hl
	ld a,(hl)
	sbc #00
	ld bc,(l3bcb)
	ld b,a
	call l3889
	dec c
	pop af
	ld b,a
	call l3889
	ret
.l3d6a
	ld a,(l3c05)
	and a
	jp m,l3d85
	ld de,l3c02
	ld a,(de)
	ld hl,l3c06
	add (hl)
	ld (de),a
	ld hl,l3c07
	cp (hl)
	ret nz
	ld a,#ff
	ld (l3c05),a
	ret
.l3d85
	ld de,l3c02
	ld a,(de)
	ld hl,l3c06
	sub (hl)
	ld (de),a
	ret nz
	ld a,#01
	ld (l3c05),a
	ld a,(l3c04)
	xor #fe
	ld (l3c04),a
	ret
.l3d9d
	ld a,(l3bc6)
	and a
	ret z
	ld a,(l3c10)
	and a
	ret z
	ld a,(l3c11)
	xor #08
	ld (l3c11),a
	ld b,a
	ld c,#06
	jp l3889
.l3db5
	dw l3de5
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00
	dw l3e1b,l3df3
	db #00,#00,#00,#00,#00,#00,#00,#00
	dw l3f95,l3fa0
	db #00,#00
	dw l3fe1,l3fab,l3fbd
	db #00,#00,#00,#00,#00,#00
	dw l3fcf
.l3de5
	xor a
	ld (l3bc5),a
	ld (l3bc6),a
	ld (l3bc7),a
	ld (l3bc8),a
	ret
.l3df3
	ld a,#01
	ld (l3c10),a
	ret
.l3df9
	sub #1f
	ld de,(l3bc9)
	ld hl,l3be4
	add hl,de
	ld (hl),a
	ret
.l3e05
	xor a
	ld (l3c08),a
	ld (l3c09),a
	ld hl,l3be1
	ld de,(l3bc9)
	add hl,de
	ld (hl),a
	ld hl,l3bff
	add hl,de
	ld (hl),a
	ret
.l3e1b
	ld hl,(l3bc0)
	ld de,(l3bbe)
	add hl,de
	ld a,(hl)
	push af
	inc hl
	inc de
	ld a,(hl)
	push af
	inc hl
	inc de
	ld a,(hl)
	inc de
	ld (l3bbe),de
	ld de,(l3bc9)
	ld hl,l3bf9
	add hl,de
	ld (hl),a
	ld hl,l3bde
	add hl,de
	pop af
	ld (hl),a
	ld hl,l3bf6
	add hl,de
	and #f0
	ld (hl),a
	ld hl,l3bdb
	add hl,de
	pop af
	ld (hl),a
	ld hl,l3bf3
	add hl,de
	and #f0
	ld (hl),a
	ret
.l3e55
	ld a,(l3bc6)
	and a
	jr z,l3ec2
	ld a,(l3bff)
	and a
	jr z,l3ec2
	ld a,(l3bfc)
	and a
	jp m,l3e98
	ld a,(l3bf3)
	sub #10
	ld (l3bf3),a
	jr nz,l3ec2
	ld a,(l3bdb)
	ld b,a
	and #f0
	ld (l3bf3),a
	ld a,b
	and #0f
	ld hl,l3bd8
	add (hl)
	ld (l3bd8),a
	push af
	ld b,a
	ld c,#08
	call l3889
	pop af
	cp #0f
	jr nz,l3ec2
	ld a,#80
	ld (l3bfc),a
	jr l3ec2
.l3e98
	ld a,(l3bf6)
	sub #10
	ld (l3bf6),a
	jr nz,l3ec2
	ld a,(l3bde)
	ld b,a
	and #f0
	ld (l3bf6),a
	ld a,b
	and #0f
	ld b,a
	ld a,(l3bd8)
	ld hl,l3bf9
	cp (hl)
	jr z,l3ec2
	sub b
	ld (l3bd8),a
	ld b,a
	ld c,#08
	call l3889
.l3ec2
	ld a,(l3bc7)
	and a
	jr z,l3f2f
	ld a,(l3c00)
	and a
	jr z,l3f2f
	ld a,(l3bfd)
	and a
	jp m,l3f05
	ld a,(l3bf4)
	sub #10
	ld (l3bf4),a
	jr nz,l3f2f
	ld a,(l3bdc)
	ld b,a
	and #f0
	ld (l3bf4),a
	ld a,b
	and #0f
	ld hl,l3bd9
	add (hl)
	ld (l3bd9),a
	push af
	ld b,a
	ld c,#09
	call l3889
	pop af
	cp #0f
	jr nz,l3f2f
	ld a,#80
	ld (l3bfd),a
	jr l3f2f
.l3f05
	ld a,(l3bf7)
	sub #10
	ld (l3bf7),a
	jr nz,l3f2f
	ld a,(l3bdf)
	ld b,a
	and #f0
	ld (l3bf7),a
	ld a,b
	and #0f
	ld b,a
	ld a,(l3bd9)
	ld hl,l3bfa
	cp (hl)
	jr z,l3f2f
	sub b
	ld (l3bd9),a
	ld b,a
	ld c,#09
	call l3889
.l3f2f
	ld a,(l3bc8)
	and a
	ret z
	ld a,(l3c01)
	and a
	ret z
	ld a,(l3bfe)
	and a
	jp m,l3f6d
	ld a,(l3bf5)
	sub #10
	ld (l3bf5),a
	ret nz
	ld a,(l3bdd)
	ld b,a
	and #f0
	ld (l3bf5),a
	ld a,b
	and #0f
	ld hl,l3bda
	add (hl)
	ld (l3bda),a
	push af
	ld b,a
	ld c,#0a
	call l3889
	pop af
	cp #0f
	ret nz
	ld a,#80
	ld (l3bfe),a
	ret
.l3f6d
	ld a,(l3bf8)
	sub #10
	ld (l3bf8),a
	ret nz
	ld a,(l3be0)
	ld b,a
	and #f0
	ld (l3bf8),a
	ld a,b
	and #0f
	ld b,a
	ld a,(l3bda)
	ld hl,l3bfb
	cp (hl)
	ret z
	sub b
	ld (l3bda),a
	ld b,a
	ld c,#0a
	jp l3889
.l3f95
	ld de,(l3bc9)
	ld hl,l3be1
	add hl,de
	ld (hl),#01
	ret
.l3fa0
	ld de,(l3bc9)
	ld hl,l3be1
	add hl,de
	ld (hl),#00
	ret
.l3fab
	ld de,(l3bc9)
	ld hl,l3fba
	add hl,de
	ld a,(hl)
	ld hl,l3bcd
	add hl,de
	ld (hl),a
	ret
.l3fba
	cp #fd
	ei
.l3fbd
	ld de,(l3bc9)
	ld hl,l3fcc
	add hl,de
	ld a,(hl)
	ld hl,l3bcd
	add hl,de
	ld (hl),a
	ret
.l3fcc
	db #f7,#ef,#df
.l3fcf
	ld hl,(l3bc0)
	ld de,(l3bbe)
	add hl,de
	ld a,(hl)
	ld (l3c11),a
	inc de
	ld (l3bbe),de
	ret
.l3fe1
	ld hl,(l3bc0)
	ld de,(l3bbe)
	add hl,de
	ld a,(hl)
	ld (l3bd0),a
	inc de
	ld (l3bbe),de
	ret
	dw l40c3,l40cd,l40cd,l40cd
	dw l40cd,l40d1,l40d1,l40d1
	dw l40d1,l40d5,l40d5,l40d5
	dw l40d9,l40cd,l40cd,l40cd
	dw l40cd,l40d1,l40d1,l40d1
	dw l40d1,l40d5,l40d5,l40d5
	dw l40d9,l40cd,l40cd,l40cd
	dw l40cd,l40d1,l40d1,l40d1
	dw l40d1,l40d5,l40d5,l40d5
	dw l40d9,l40dd,l40dd,l40e1
	dw l40e1,l40dd,l40dd,l40e1
	dw l40e1,l40dd,l40dd,l40e5
	dw #0000,l4119,l40ec,l40f3
	dw l40f3,l40f3,l40f3,l40f8
	dw l40f8,l40f8,l40f8,l40fd
	dw l40fd,l40fd,l4102,l40f3
	dw l40f3,l40f3,l40f3,l40f8
	dw l40f8,l40f8,l40f8,l40fd
	dw l40fd,l40fd,l4102,l4107
	dw l4107,l410c,l410c,l4107
	dw l4107,l410c,l410c,l4107
	dw l4107,l4111,#0000,l4128
	dw l412f,l4134,l4139,l412f
	dw l4134,l4139,l412f,l4134
	dw l4139,l413e,l4142,l413e
	dw l4142,l413e,l4146,#0000
.l40c3
	db #91,#05,#92,#8e,#a3,#88,#1f,#c1
.l40d1 equ $ + 6
.l40cd equ $ + 2
	db #08,#7f,#19,#24,#27,#7f,#15,#20
.l40d9 equ $ + 6
.l40d5 equ $ + 2
	db #24,#7f,#14,#1b,#22,#7f,#14,#17
.l40e1 equ $ + 6
.l40dd equ $ + 2
	db #1b,#7f,#20,#24,#27,#7f,#20,#25
.l40e5 equ $ + 2
	db #29,#7f,#20,#23,#27,#20,#23,#25
.l40ec equ $ + 1
	db #7f,#92,#8e,#88,#1f,#c1,#08,#7f
.l40f8 equ $ + 5
.l40f3
	db #a3,#39,#34,#37,#7f,#a3,#3b,#40
.l4102 equ $ + 7
.l40fd equ $ + 2
	db #34,#7f,#a3,#34,#a7,#3b,#7f,#a3
.l4107 equ $ + 4
	db #34,#37,#3b,#7f,#a3,#40,#34,#37
.l4111 equ $ + 6
.l410c equ $ + 1
	db #7f,#a3,#40,#3b,#39,#7f,#a3,#40
.l4119 equ $ + 6
	db #39,#37,#40,#39,#3b,#7f,#92,#ab
	db #7e,#7e,#7e,#7e,#7e,#7e,#7e,#7e
.l4128 equ $ + 5
	db #7e,#7e,#7e,#7e,#7f,#92,#8e,#88
.l412f equ $ + 4
	db #1f,#c1,#08,#7f,#cb,#19,#a3,#19
.l4139 equ $ + 6
.l4134 equ $ + 1
	db #7f,#cb,#15,#a3,#15,#7f,#cb,#14
.l4142 equ $ + 7
.l413e equ $ + 3
	db #a3,#14,#7f,#ab,#10,#10,#7f,#ab
.l4146 equ $ + 3
	db #15,#15,#7f,#ab,#10,#20,#7f
	dw l41f0,l41f0,l41f0,l41f0
	dw l4217,l4229,l4217,l4233
	dw l41f0,l41f0,l41f0,l41f0
	dw l41f0,l41f0,l41f0,l41f0
	dw l4217,l4229,l4217,l4233
	dw l41f0,l41f0,l41f0,l41f0
	dw l41f0,l41f0,l41f0,l41f0
	dw l4217,l4229,l4217,l4233
	dw l425e,l425e,l425e,l425e
	dw l425e,l425e,l425e,l425e
	dw #0000,l427f,l427f,l4297
	dw l427f,l427f,l427f,l427f
	dw l4297,l427f,l427f,l427f
	dw l427f,l4297,l42b9,l42b9
	dw l42cb,l42cb,#0000,l427f
	dw l427f,l4297,l42dd,l42dd
	dw l42dd,l42dd,l42f3,l42dd
	dw l42dd,l42dd,l42dd,l42f3
	dw l4311,l4311,l4324,l4324
	dw #0000
	db #88,#1f,#13,#06,#88,#1f,#11,#06
.l41f0 equ $ + 4
	db #88,#1f,#13,#06,#91,#06,#93,#a0
	db #88,#1f,#13,#06,#97,#1f,#89,#00
	db #88,#1f,#13,#06,#97,#01,#00,#00
	db #00,#88,#1f,#11,#06,#97,#07,#89
	db #00,#88,#1f,#13,#06,#97,#01,#00
	db #00,#00,#7f
.l4217
	db #88,#1f,#11,#06,#a0,#97,#07,#89
	db #00,#a4,#89,#00,#a0,#89,#00,#89
	db #00,#7f
.l4229
	db #88,#1f,#11,#06,#a7,#97,#07,#89
.l4232 equ $ + 1
	db #00,#7f
.l4233
	db #88,#1f,#13,#06,#a0,#97,#1f,#89
	db #00,#88,#1f,#11,#06,#97,#07,#89
	db #00,#89,#00,#89,#00,#88,#1f,#13
	db #06,#a0,#97,#1f,#89,#00,#88,#1f
	db #11,#06,#97,#07,#89,#00,#89,#00
	db #89,#00,#7f
.l425e
	db #88,#1f,#13,#06,#a0,#97,#1f,#89
	db #00,#88,#1f,#13,#06,#97,#01,#00
	db #00,#00,#88,#1f,#11,#06,#a1,#97
	db #07,#89,#00,#a0,#89,#00,#89,#00
	db #7f
.l427f
	db #92,#8e,#88,#1f,#21,#0a,#a2,#08
	db #a0,#18,#18,#18,#18,#18,#08,#a1
	db #08,#a0,#18,#18,#18,#18,#18,#7f
.l4297
	db #a2,#05,#a0,#15,#15,#15,#25,#35
	db #05,#05,#15,#15,#25,#25,#30,#35
	db #05,#a1,#05,#a0,#15,#15,#15,#25
	db #35,#05,#15,#15,#25,#25,#35,#35
	db #40,#7f
.l42b9
	db #a2,#11,#a0,#21,#21,#21,#28,#28
	db #11,#a1,#11,#a0,#18,#21,#21,#28
.l42cb equ $ + 2
	db #31,#7f,#a2,#13,#a0,#23,#23,#23
	db #2a,#2a,#13,#a1,#13,#a0,#1a,#23
	db #23,#2a,#33,#7f
.l42dd
	db #92,#8e,#88,#1f,#21,#0a,#a1,#28
	db #28,#a0,#30,#a1,#33,#a0,#35,#45
	db #45,#a1,#33,#30,#33,#7f
.l42f3
	db #a1,#15,#28,#30,#a0,#31,#a2,#30
	db #a1,#38,#40,#a0,#41,#a2,#40,#a1
	db #28,#30,#a0,#31,#a2,#30,#a1,#35
.l4311 equ $ + 6
	db #a0,#45,#43,#40,#3a,#7f,#a0,#31
	db #a1,#31,#a0,#31,#30,#30,#2a,#28
	db #38,#38,#37,#35,#38,#38,#37,#35
	db #7f
.l4324
	db #a0,#31,#a1,#31,#a0,#31,#30,#2b
.l4333 equ $ + 7
	db #2a,#28,#33,#35,#36,#37,#33,#35
	db #36,#37,#7f
	dw l43b7,#0000,l4409,l4409
	dw l4409,l4409,l4419,l4419
	dw l4419,l4419,l4409,l4409
	dw l4409,l4409,l4419,l4419
	dw l4419,l4419,l4409,l4409
	dw l4409,l4409,l4419,l4419
	dw l4419,l4419,l4409,l4409
	dw l4409,l4409,l4419,l4419
	dw l4419,l4419,l4422,l4422
	dw l4422,l4422,l442b,l442b
	dw l442b,l442b,#0000,l4434
	dw l444c,l445d,l446e,l447f
	dw l4490,l445d,l446e,l4434
	dw l444c,l445d,l446e,l447f
	dw l4490,l445d,l446e,l44a1
	dw l44b2,l44a1,l44c3,#0000
.l43b7
	db #91,#06,#93,#a0,#88,#1f,#13,#06
	db #97,#1f,#89,#00,#88,#1f,#13,#06
	db #97,#01,#00,#00,#00,#88,#1f,#11
	db #06,#a1,#97,#07,#89,#00,#88,#1f
	db #13,#06,#a0,#97,#1f,#89,#00,#88
	db #1f,#13,#06,#97,#01,#00,#00,#00
	db #88,#1f,#13,#06,#97,#1f,#89,#00
	db #88,#1f,#13,#06,#97,#01,#00,#88
	db #1f,#11,#06,#a1,#97,#07,#89,#00
	db #88,#1f,#13,#06,#a0,#97,#01,#00
.l4409 equ $ + 2
	db #00,#7f,#92,#8e,#a0,#88,#1f,#21
	db #0a,#13,#1a,#1a,#13,#23,#13,#13
.l4419 equ $ + 2
	db #23,#7f,#10,#17,#17,#10,#20,#10
.l4422 equ $ + 3
	db #10,#20,#7f,#18,#23,#23,#18,#28
.l442b equ $ + 4
	db #18,#18,#28,#7f,#1a,#25,#25,#1a
.l4434 equ $ + 5
	db #2a,#1a,#1a,#2a,#7f,#92,#8e,#a0
	db #88,#1f,#21,#0a,#17,#27,#37,#17
	db #27,#37,#17,#27,#37,#17,#27,#37
.l444c equ $ + 5
	db #17,#27,#37,#47,#7f,#17,#27,#37
	db #17,#27,#37,#17,#27,#37,#17,#27
.l445d equ $ + 6
	db #37,#12,#22,#32,#42,#7f,#10,#20
	db #30,#10,#20,#30,#10,#20,#30,#10
.l446e equ $ + 7
	db #20,#30,#10,#20,#30,#40,#7f,#10
	db #20,#30,#10,#20,#30,#10,#20,#30
	db #10,#20,#30,#12,#22,#32,#42,#7f
.l447f
	db #1a,#1a,#2a,#1a,#1a,#2a,#1a,#1a
	db #2a,#1a,#1a,#2a,#1a,#1a,#2a,#3a
.l4490 equ $ + 1
	db #7f,#1a,#1a,#2a,#1a,#1a,#2a,#1a
	db #1a,#2a,#1a,#1a,#2a,#1b,#1b,#2b
.l44a1 equ $ + 2
	db #3b,#7f,#23,#33,#23,#33,#23,#33
	db #22,#32,#22,#32,#23,#33,#23,#33
	db #23,#43,#7f
.l44b2
	dw l4333,l4333,l4333,l4232
	dw l4232,l4333,l4333,#5333
.l44c3 equ $ + 1
	dw #357f,#3545,#3545,#3345
	dw #3343,#3543,#3545,#3545
	dw #7f45,l4546,l4598,l4546
	dw l4598,l4546,l4598,l4546
	dw l4598,l4546,l4546,l4598
	dw l4546,l4546,l4546,l4546
	dw l4546,l4546,l4546,l4546
	dw l4546,#0000,l45e3,l45e3
	dw l45e3,l45e3,l45e3,l45e3
	dw l45e3,l45e3,l45fb,l460c
	dw l460c,l461d,l461d,l461d
	dw l461d,l463e,#0000,l45e3
	dw l45e3,l45e3,l45e3,l464f
	dw l464f,l4679,l464f,l4667
	dw l469b,l46ad,l46ba,l46ad
	dw l46ba,l46ad,l46ba,l46ad
	dw l463e,#0000
.l4546
	db #91,#06,#93,#88,#1f,#13,#06,#a0
	db #97,#1f,#89,#00,#88,#1f,#13,#06
	db #97,#01,#00,#00,#00,#88,#1f,#11
	db #06,#a1,#97,#07,#89,#00,#88,#1f
	db #13,#06,#a0,#97,#1f,#89,#00,#88
	db #1f,#13,#06,#97,#01,#00,#88,#1f
	db #13,#06,#97,#1f,#89,#00,#88,#1f
	db #13,#06,#97,#01,#00,#00,#00,#88
	db #1f,#11,#06,#a1,#97,#07,#89,#00
	db #88,#1f,#13,#06,#a0,#97,#01,#00
.l4598 equ $ + 2
	db #00,#7f,#88,#1f,#13,#06,#a0,#97
	db #1f,#89,#00,#88,#1f,#13,#06,#97
	db #01,#00,#00,#00,#88,#1f,#11,#06
	db #a1,#97,#07,#89,#00,#88,#1f,#13
	db #06,#a0,#97,#1f,#89,#00,#88,#1f
	db #13,#06,#97,#01,#00,#88,#1f,#13
	db #06,#97,#1f,#89,#00,#88,#1f,#13
	db #06,#97,#01,#00,#88,#1f,#11,#06
	db #a1,#97,#07,#89,#00,#89,#00,#a0
.l45e3 equ $ + 5
	db #89,#00,#89,#00,#7f,#92,#8e,#a0
	db #88,#1f,#21,#0a,#11,#11,#11,#21
	db #11,#11,#11,#21,#11,#11,#11,#21
.l45fb equ $ + 5
	db #11,#11,#11,#21,#7f,#11,#11,#11
	db #21,#11,#11,#11,#21,#11,#11,#11
.l460c equ $ + 6
	db #21,#08,#08,#08,#18,#7f,#08,#08
	db #08,#18,#08,#08,#08,#18,#08,#08
.l461d equ $ + 7
	db #08,#18,#08,#08,#08,#18,#7f,#09
	db #09,#09,#19,#09,#09,#09,#19,#09
	db #09,#09,#19,#09,#09,#09,#19,#0b
	db #0b,#0b,#1b,#0b,#0b,#0b,#1b,#0b
	db #0b,#0b,#1b,#0b,#0b,#0b,#1b,#7f
.l463e
	db #0b,#0b,#1b,#2b,#0b,#0b,#1b,#2b
	db #0b,#0b,#1b,#2b,#0b,#0b,#1b,#2b
.l464f equ $ + 1
	db #7f,#92,#8e,#a0,#88,#1f,#21,#0a
	db #28,#38,#24,#28,#33,#34,#24,#34
	db #38,#48,#34,#38,#43,#44,#34,#44
.l4667 equ $ + 1
	db #7f,#a0,#28,#38,#2b,#38,#33,#38
	db #28,#38,#28,#38,#2b,#38,#33,#38
.l4679 equ $ + 3
	db #28,#38,#7f,#a0,#48,#46,#44,#43
	db #41,#3b,#39,#38,#36,#34,#33,#31
	db #2b,#29,#28,#26,#24,#23,#21,#1b
	db #19,#18,#16,#14,#13,#11,#0b,#09
.l469b equ $ + 5
	db #08,#06,#08,#09,#7f,#a0,#34,#33
	db #31,#2b,#29,#28,#26,#24,#23,#21
.l46ad equ $ + 7
	db #1b,#19,#18,#16,#18,#19,#7f,#a1
	db #28,#28,#26,#a0,#26,#a2,#24,#a1
.l46ba equ $ + 4
	db #24,#23,#21,#7f,#a1,#26,#26,#24
	db #a0,#24,#a2,#23,#a1,#23,#21,#1b
	db #7f
	dw l46d3,#0000,l46e5,#0000
	dw l46f5,#0000
.l46d3
	db #91,#05,#92,#8e,#88,#1f,#41,#00
	db #a2,#17,#a0,#17,#17,#ab,#34,#80
.l46e5 equ $ + 2
	db #00,#7f,#92,#8e,#88,#1f,#41,#00
	db #a2,#35,#a0,#35,#35,#ab,#37,#80
.l46f5 equ $ + 2
	db #00,#7f,#92,#8e,#88,#1f,#41,#00
	db #a2,#37,#a0,#37,#37,#ab,#40,#80
	db #00,#7f
	dw l4711,#0000,l4720,#0000
	dw l472d,#0000
.l4711
	db #91,#05,#92,#8e,#88,#1f,#41,#00
.l4720 equ $ + 7
	db #a1,#31,#ab,#27,#80,#00,#7f,#92
	db #8e,#88,#1f,#41,#00,#a1,#32,#ab
.l472d equ $ + 4
	db #28,#80,#00,#7f,#92,#8e,#88,#1f
	db #41,#00,#a1,#21,#ab,#17,#80,#00
	db #7f

;
.game_name
	db "Max Headroom",0
.game_year
	db "1986",0
.game_publisher
	db "Quicksilva",0
.music_author
	db "",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
